package com.zenchn.schedule;



import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;


/**
 * 定时任务工厂类
 *
 * @author panbingqi
 * @date 2021-06-01
 */
public class SchedulerFutureFactory {

    /**
     * 获取定时任务实例
     * @param schedulerId
     * @param runnable
     * @param fixedDelay
     * @param threadPoolTaskScheduler
     * @return
     */
    public static TaskScheduler createTaskScheduler(String schedulerId, Runnable runnable, Long fixedDelay,
                                                        ThreadPoolTaskScheduler threadPoolTaskScheduler) {
        return new TaskScheduler(runnable, fixedDelay, threadPoolTaskScheduler);
    }

    /**
     * 获取定时任务实例
     * @param schedulerId
     * @param runnable
     * @param cron
     * @param threadPoolTaskScheduler
     * @return
     */
    public static TaskScheduler createTaskScheduler(String schedulerId, Runnable runnable, String cron,
                                                    ThreadPoolTaskScheduler threadPoolTaskScheduler) {
        return new TaskScheduler(runnable, cron, threadPoolTaskScheduler);
    }



}